package com.emos.controller;

import com.emos.form.TestForm;
import com.emos.utils.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

@RestController
@RequestMapping("demo")
@Api
public class DemoController {

    @PostMapping("test")
    @ApiOperation("测试方法")
    public R test(){
        return new R().put("msg","demo");
    }

    @PostMapping("say")
    @ApiOperation("测试参数")
    public R say(@Valid @RequestBody TestForm testForm){
        return R.ok().put("name",testForm.getName());
    }
}
